package com.mj.priqueue;

/**
 * @Author: LDeng
 * @Date: 2021-03-19 10:16
 */
public class Person implements Comparable<Person> {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public int compareTo(Person person) {
        //当前person和外面传进来的person比较
        return this.age-person.age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
